<script setup lang="ts">
let timeout = 3
const timer = setInterval(() => {
  timeout--
  if (timeout === 0) {
    clearInterval(timer)
    window.location.href = "/home"
  }
}, 1000)
</script>

<template>
  <div id="Content">
    <div class="box">
      <h1>Welcome to JPetStore</h1>
      <h2 id="loading">Loading</h2>
      <div class="loading">
        <div class="block" />
        <div class="block" />
        <div class="block" />
        <div class="block" />
        <div class="block" />
        <div class="block" />
        <div class="block" />
        <div class="block" />
        <div class="block" />
        <div class="block" />
        <div class="block" />
        <div class="block" />
        <div class="block" />
        <div class="block" />
        <div class="block" />
        <div class="block" />
      </div>
      <el-link href="home" :underline="false" class="link2home">页面将在3秒后自动跳转，若未跳转请点我</el-link>
    </div>
  </div>
</template>

<style scoped>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html,
body {
  height: 100%;
  background: linear-gradient(to right, rgb(247, 209, 215), rgb(191, 227, 241));
}
h1 {
  padding: 20px;
  text-align: center;
  color: white;
  /* 禁止选中 */
  user-select: none;
  letter-spacing: 5px;
  text-shadow: 4px 4px 3px rgba(0, 0, 0, 0.1);
  font-weight: bold;
}
h2 {
  font-weight: bold;
  text-align: center;
  color: white;
  /* 禁止选中 */
  user-select: none;
  letter-spacing: 5px;
  text-shadow: 4px 4px 3px rgba(0, 0, 0, 0.1);
}
p {
  text-align: center;
  margin-top: 5%;
  text-shadow: 4px 4px 3px rgba(0, 0, 0, 0.1);
}
.box {
  width: 700px;
  height: 350px;
  z-index: 2;
  margin-top: 20%;
  margin: auto;
  /* 设置圆角 */
  border-radius: 8px;
  /* 设置边框 */
  border: 1px solid rgba(255, 255, 255, 0.6);
  /* 设置盒子阴影 */
  box-shadow: 2px 1px 19px rgba(0, 0, 0, 0.1);
}
.link2home {
  text-align: center;
  margin-top: 5%;
  text-shadow: 4px 4px 3px rgba(0, 0, 0, 0.1);
  margin-left: 31%;
}
.loading {
  width: 80px;
  height: 100px;
  margin: 20px auto;
}
.block {
  position: relative;
  box-sizing: border-box;
  float: left;
  margin: 0 10px 10px 0;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: #fff;
}

.block:nth-child(4n + 1) {
  animation: wave 2s ease 0s infinite;
}
.block:nth-child(4n + 2) {
  animation: wave 2s ease 0.2s infinite;
}
.block:nth-child(4n + 3) {
  animation: wave 2s ease 0.4s infinite;
}
.block:nth-child(4n + 4) {
  animation: wave 2s ease 0.6s infinite;
  margin-right: 0;
}

@keyframes wave {
  0% {
    top: 0;
    opacity: 1;
  }
  50% {
    top: 30px;
    opacity: 0.2;
  }
  100% {
    top: 0;
    opacity: 1;
  }
}
.box {
  width: 700px;
  height: 350px;
  z-index: 2;
  margin-top: 20%;
  margin: auto;
  /* 设置圆角 */
  border-radius: 8px;
  /* 设置边框 */
  border: 1px solid rgba(255, 255, 255, 0.6);
  /* 设置盒子阴影 */
  box-shadow: 2px 1px 19px rgba(0, 0, 0, 0.1);
}

.loading {
  width: 80px;
  height: 100px;
  margin: 20px auto;
}
.block {
  position: relative;
  box-sizing: border-box;
  float: left;
  margin: 0 10px 10px 0;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: #fff;
}

.block:nth-child(4n + 1) {
  animation: wave 2s ease 0s infinite;
}
.block:nth-child(4n + 2) {
  animation: wave 2s ease 0.2s infinite;
}
.block:nth-child(4n + 3) {
  animation: wave 2s ease 0.4s infinite;
}
.block:nth-child(4n + 4) {
  animation: wave 2s ease 0.6s infinite;
  margin-right: 0;
}

@keyframes wave {
  0% {
    top: 0;
    opacity: 1;
  }
  50% {
    top: 30px;
    opacity: 0.2;
  }
  100% {
    top: 0;
    opacity: 1;
  }
}
</style>
